package com.baoji.auth.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

/**
 * @Auther: ghm
 * @Date: 2021/09/23/18:09
 * @Description:
 */
@Api(tags = "任务控制器")
@RestController
@RequestMapping("/task")
public class TaskController {

    @ApiOperation(value = "任务列表", notes = "需要登录")
    @GetMapping("/getTasks")
    @ResponseBody
    public String listTasks(){
        return "任务列表";
    }


    @ApiOperation(value = "创建一个新的任务", notes = "需要登录")
    @ApiImplicitParam(name = "token", required = true, paramType = "header", dataType = "String")
    @PostMapping
    @PreAuthorize("hasRole('ADMIN')")
    public String newTasks(){

        return "创建了一个新的任务";
    }
}
